<?php
/**
 * Created by PhpStorm.
 * User: sunzexin
 * Date: 2018/1/23
 * Time: 11:37
 */

namespace App\Http\Controllers\Admin;


use App\Http\Traits\MarkTrait;
use App\Http\Logics\Admin\MarkLogic;
use App\Http\Controllers\BaseController;
class MarkController extends BaseController
{
    use MarkTrait;
    /**
     * @SWG\Post(
     *     path="/mark/list",
     *     tags={"Mark"},
     *     description="获取咖啡馆标签列表",
     *     operationId="getMarkList",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="is_menu",
     *         in="query",
     *         description="是否是标签菜单",
     *         required=false,
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function getMarkList()
    {
        $is_menu = $this->is_menu;
        $limit = $this->limit;
        $data = [
            'is_menu' => $is_menu,
            'limit' => $limit
        ];
        $response = MarkLogic::getMarkList($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }

    public function setMarkStatus()
    {
        $mark_id = $this->mark_id;
        $data = [
            'mark_id' => $mark_id
        ];
        $response = MarkLogic::setCafeStatus($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }

    public function setMarkIsCommon()
    {
        $mark_id = $this->mark_id;
        $data = [
            'mark_id' => $mark_id
        ];
        $response = MarkLogic::setMarkIsCommon($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }
}